using Domain;
using ErrorCode;
using MediatR;
using System;
using System.Collections.Generic;

namespace WriteAPI.Command.生产计划
{
    /// <summary>
    /// 更新生产计划命令
    /// </summary>
    public class UpdateProductionPlanCommand : IRequest<APIResult<bool>>
    {
        /// <summary>
        /// 计划ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 计划主题
        /// </summary>
        public string PlanTheme { get; set; } = string.Empty;
        
        /// <summary>
        /// 计划单号
        /// </summary>
        public string PlanNumber { get; set; } = string.Empty;
        
        /// <summary>
        /// 销售订单号
        /// </summary>
        public string SalesOrder { get; set; } = string.Empty;
        
        /// <summary>
        /// 关联项目
        /// </summary>
        public string RelatedProject { get; set; } = string.Empty;
        
        /// <summary>
        /// 单据日期
        /// </summary>
        public DateTime DocumentDate { get; set; } = DateTime.Now;
        
        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; } = string.Empty;
        
        /// <summary>
        /// 生产物品明细列表 - 需要添加的新物品
        /// </summary>
        public List<ProductionItemDetail>? NewItems { get; set; }
        
        /// <summary>
        /// 需要更新的物品明细
        /// </summary>
        public List<UpdateProductionItemDetail>? UpdatedItems { get; set; }
        
        /// <summary>
        /// 需要删除的物品明细ID列表
        /// </summary>
        public List<int>? DeletedItemIds { get; set; }
        
        /// <summary>
        /// 附件列表 - 新增的附件
        /// </summary>
        public List<AttachmentInfo>? NewAttachments { get; set; }
        
        /// <summary>
        /// 需要删除的附件ID列表
        /// </summary>
        public List<int>? DeletedAttachmentIds { get; set; }
    }

    /// <summary>
    /// 生产物品明细项更新数据
    /// </summary>
    public class UpdateProductionItemDetail
    {
        /// <summary>
        /// 明细项ID
        /// </summary>
        public int Id { get; set; }
        
        /// <summary>
        /// 物品编号
        /// </summary>
        public string ItemCode { get; set; } = string.Empty;
        
        /// <summary>
        /// 物品名称
        /// </summary>
        public string ItemName { get; set; } = string.Empty;
        
        /// <summary>
        /// 规格型号
        /// </summary>
        public string Spec { get; set; } = string.Empty;
        
        /// <summary>
        /// 单位
        /// </summary>
        public string Unit { get; set; } = string.Empty;
        
        /// <summary>
        /// 物品类别
        /// </summary>
        public string ItemCategory { get; set; } = string.Empty;
        
        /// <summary>
        /// 物品分类
        /// </summary>
        public string ItemClass { get; set; } = string.Empty;
        
        /// <summary>
        /// 品牌
        /// </summary>
        public string Brand { get; set; } = string.Empty;
        
        /// <summary>
        /// 数量
        /// </summary>
        public decimal Quantity { get; set; } = 0;
        
        /// <summary>
        /// 详情日期
        /// </summary>
        public DateTime? DetailDate { get; set; }
        
        /// <summary>
        /// 主单位数量
        /// </summary>
        public decimal MainUnitQuantity { get; set; } = 0;
        
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; } = string.Empty;
    }
} 